<div class="layui-form-item">
          <label class="layui-form-label">{{name}}</label>
          <div class="layui-input-inline">
             <input name="{{field}}" id="{{field}}" lay-verify="{{required}}" placeholder="{{name}}" value="{{value}}" class="layui-input">
           </div>
           <div class="layui-input-inline layui-btn-container" style="width: auto;">
                   <button type="button" class="layui-btn imageModelUpload" id="imageModelUpload_{{field}}"><i class="layui-icon">&#xe67c;</i>上传图片</button>
                   <button class="layui-btn layui-btn-primary imageShow{{field}}">查看图片</button >
          </div>
</div>
<script language="javascript">
    layui.use('upload', function () {
		var $ = layui.$, admin = layui.admin, table = layui.table, element = layui.element, form = layui.form,util = layui.util, upload = layui.upload;
		var pic = $('#{{field}}');
		upload.render({
                        elem:'#imageModelUpload_{{field}}', 
                        url: '{{upload_uri}}',
                        title: '上传图片',
                        ext: '{{upload_allowext}}', 
                        done: function(res){
                             $('#{{field}}').val(res.url);
                        }
         });	
		 
		 //监听查看图片按钮
		$('.imageShow{{field}}').on('click', function () {
				var src = pic.val();
				layer.photos({
					photos: {
						"title": "查看图片" //相册标题
						, "data": [{
							"src": src //原图地址
						}]
					}
					, shade: 0.5
					, closeBtn: 1
					, anim: 5
				});
		});		
			
 });			
</script>